<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .box{
            width: 610px;
            display: flex;
            margin: auto;
            margin-top: 200px;
        }
        img{
            width: 40px;
            height: 40px;
            border-radius: 50% 50%;
            margin-right: 10px;
        }
        .t1{
            position: relative;
        }
        .txt{
            position: absolute;
            right: 0;
            color: #afacac00;
        }
        input{
            width: 500px;
            height: 46px;
        }
        button{
            width: 52px;
            height: 52px;
            background-color: cornflowerblue;
            color: #fff;
            border: none;
            border-radius: 8% 8%;
        }
    </style>
</head>
<body>
    <div class="box">
        <img src="../../images/渲染列表图片/course08.png" alt="头像">
        <div class="t1">
            <input type="text" placeholder="发一条友善的评论">
            <div class="txt">0/200</div>
        </div>
        <button>发布</button>  
    </div>
    <script>
        const inp=document.querySelector('input')
        const divv=document.querySelector('.txt')
        inp.addEventListener('focus',function(){
            inp.style.height='80px'
            inp.style.outline='none'
            divv.style.color='#afacac'
        })
        inp.addEventListener('blur',function(){
            inp.style.height='50px'
            divv.style.color='#afacac00'
        })
        inp.addEventListener('input',function(){
            console.log(inp.value.length);
        })
        inp.addEventListener('keyup',function(){
            divv.innerHTML=`${inp.value.length}/200`
        })
    </script>
</body>
</html>